package org.lease.web.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.lease.common.result.Result;
import org.lease.model.entity.PaymentType;
import org.lease.service.PaymentTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "支付信息")
@RestController
@RequestMapping("/app/payment")
public class PaymentController {
    @Autowired
    private PaymentTypeService paymentTypeService;

    @Operation(summary = "查询所有支付方式")
    @GetMapping("/list")
    public Result<List<PaymentType>> list() {
        List<PaymentType> list = paymentTypeService.list();
        return Result.success(list);
    }

    @Operation(summary = "根据房间id获取可选支付方式列表")
    @GetMapping("listByRoomId")
    public Result<List<PaymentType>> list(@RequestParam Long id) {
        List<PaymentType> list = paymentTypeService.listByRoomId(id);
        return Result.success(list);
    }
}
